/*
 *  Copyright 2013 National Institute of Advanced Industrial Science and Technology
 *  
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *  
 *      http://www.apache.org/licenses/LICENSE-2.0
 *  
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */

package org.sss.mapreduce.datatype;

/**
 * Something that could be serialized/de-serialized by SSS.
 */
public interface Packable {
  /**
   * Indicates whether some other object is "equal to" this one.
   * @param o the reference object with which to compare.
   * @return true if this object is the same as the obj argument;
   * false otherwise.
   */
  @Override
  public boolean equals(Object o);
  /**
   * Returns a hash code value for the object.
   * This method is supported for the benefit of hashtables such as those
   * provided by java.util.Hashtable.
   * @return a hash code value for this object.
   */
  public int hashCode();
  /**
   * Indicates which slot this object should be put.
   * The `slot' means a group keys.  When this object is used as a key
   * to store a key-value pair in a storage server, this value determines
   * which group the pair would be stored.
   * @return slot number.
   */
  public int slot();
  /**
   * Get a rough size of serialized object in bytes.
   * @return rough size of serialized object in bytes.
   */
  public long getRoughSize();
}
